import type { DefineStoreOptions } from 'pinia'
const loadOptions: Omit<DefineStoreOptions<string, ILoadState, any, ILoadAction>, 'id'> = {
  state() {
    return {
      isOverlay: false,
      cacheList: [],
      slideName: 'slide-left'
    }
  },
  actions: {
    sync_update_isOverlay(isOverlay) {
      this.isOverlay = isOverlay
    },
    sync_update_cacheList({ name, meta }) {
      if (this.cacheList.includes(name)) return
      meta.keepAlive && this.cacheList.push(name)
    },
    sync_update_slideName(slideName) {
      this.slideName = slideName
    }
  }
}

export const useLoadStore = defineStore('load', loadOptions)

export default useLoadStore
